//表单组件实例 每次通过左侧拖拽对应得组件渲染生成表单组件都是通过实例进行渲染 。所以左侧的拖拽组件必须拥有对应得表单实例否则无法渲染拖拽后生成得组件

import {defineAsyncComponent} from "vue";
import type { Component } from "vue";


export enum entityType{
  input='input',
  spaceLayout='space-layout',
  table='table',
  rate='rate',
  dateRange='dateRange',
  upload='upload',
  slot='slot',
  radio='radio',
  checkbox='checkbox',
  radioGroup='radioGroup',
  checkboxGroup='checkboxGroup',
  switch='switch',
  inputNumber='inputNumber',
  select='select',
  signature='signature',
  cascader='cascader',
}

const draggableFormEntitys = import.meta.glob('./**/entity/**.ts') //批量导入所有的拖拽表单组件实例
console.log(draggableFormEntitys)
//批量导出所有的components/**/entity 下面的表单组件实例
export const FormEntitysMap:{
  [key in string]:any
} = {} as any
Object.keys(draggableFormEntitys).forEach(async (key) => {

  const name = /[\d\D]+\/([\d\D]+?Entity)\.ts$/.exec(key)?.[1]
  if(name){
 
 
    FormEntitysMap[name as string] =((await draggableFormEntitys[key]()) as any).default

  }
})
